package srv;

public class MobileOffersProxy implements srv.MobileOffers {
  private String _endpoint = null;
  private srv.MobileOffers mobileOffers = null;
  
  public MobileOffersProxy() {
    _initMobileOffersProxy();
  }
  
  public MobileOffersProxy(String endpoint) {
    _endpoint = endpoint;
    _initMobileOffersProxy();
  }
  
  private void _initMobileOffersProxy() {
    try {
      mobileOffers = (new srv.MobileOffersServiceLocator()).getMobileOffers();
      if (mobileOffers != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)mobileOffers)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)mobileOffers)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (mobileOffers != null)
      ((javax.xml.rpc.Stub)mobileOffers)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public srv.MobileOffers getMobileOffers() {
    if (mobileOffers == null)
      _initMobileOffersProxy();
    return mobileOffers;
  }
  
  public java.lang.String getAllBrands() throws java.rmi.RemoteException{
    if (mobileOffers == null)
      _initMobileOffersProxy();
    return mobileOffers.getAllBrands();
  }
  
  public java.lang.String getModelsByBrand(int brandId) throws java.rmi.RemoteException{
    if (mobileOffers == null)
      _initMobileOffersProxy();
    return mobileOffers.getModelsByBrand(brandId);
  }
  
  public java.lang.String getOffersByFilter(int brandId, int modelId, int yearUp, int yearDown, double priceUp, double priceDown) throws java.rmi.RemoteException{
    if (mobileOffers == null)
      _initMobileOffersProxy();
    return mobileOffers.getOffersByFilter(brandId, modelId, yearUp, yearDown, priceUp, priceDown);
  }
  
  public void insertOffer(int brandId, int modelId, int year, double price, java.lang.String contact) throws java.rmi.RemoteException{
    if (mobileOffers == null)
      _initMobileOffersProxy();
    mobileOffers.insertOffer(brandId, modelId, year, price, contact);
  }
  
  
}